import BasicLayout from '@/layout/BasicLayout.vue'
import RouteViews from '@/layout/RouteView.vue'
import type { RouteRecordRaw } from 'vue-router'


const dynamicRoutes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    redirect: '/dashboard',
    meta: {
      hideInMenu: true,
      hideChildrenInMenu: false
    },
    children: [
      // dashboard
      {
        path: '/dashboard',
        name: 'dashboard',
        component: RouteViews,
        redirect: '/dashboard/workplace',
        meta: { title: 'menu.dashboard', keepAlive: true, icon: 'DashboardOutlined' },
        children: [
          {
            path: '/dashboard/workplace',
            name: 'Workplace',
            component: () => import('@/views/dashboard/Workplace.vue'),
            meta: { title: 'menu.dashboard.workplace', keepAlive: true }
          },
          {
            path: '/dashboard/analysis',
            name: 'Analysis',
            component: () => import('@/views/dashboard/Analysis.vue'),
            meta: { title: 'menu.dashboard.analysis', keepAlive: true  }
          }
        ]
      },
      // project
      {
        path: '/project',
        name: 'project',
        component: RouteViews,
        redirect: '/project/project-list',
        meta: { title: 'menu.project', icon: 'AccountBookOutlined', permission: ['project'] },
        children: [
          {
            path: '/project/project-list',
            name: 'ProjectList',
            component: () => import('@/views/project/ProjectList.vue'),
            meta: {
              title: 'menu.project.project-list',
              keepAlive: true,
              permission: ['project']
            }
          },
          {
            path: '/project/task-list',
            name: 'TaskList',
            component: () => import('@/views/project/TaskList.vue'),
            meta: {
              title: 'menu.project.task-list',
              keepAlive: true,
              permission: ['project']
            }
          },
          {
            path: '/project/g-list',
            name: 'GList',
            component: () => import('@/views/project/GList.vue'),
            meta: {
              title: 'menu.project.g-list',
              keepAlive: true,
              permission: ['project']
            }
          }
        ]
      },
      // devices
      {
        path: '/devices',
        name: 'devices',
        component: RouteViews,
        redirect: '/devices/device-list',
        meta: { title: 'menu.devices', icon: 'DesktopOutlined', permission: ['devices'] },
        children: [
          {
            path: '/devices/device-list',
            name: 'DeviceList',
            component: RouteViews,
            redirect: '/devices/device-list/index',
            meta: { title: 'menu.devices.device-list', keepAlive: true, permission: ['devices'] },
            children: [
              {
                path: '/devices/device-list/index',
                name: 'DeviceListIndex',
                component: () => import('@/views/devices/DeviceList.vue'),
                meta: { title: 'menu.devices.device-list', keepAlive: true, permission: ['devices'], hideInBreadcrumb: true },
              },
              {
                path: '/devices/device-list/device-detail/:id',
                name: 'DeviceDetail',
                component: () => import('@/views/devices/DeviceDetail.vue'),
                meta: { title: 'menu.devices.device-detail', keepAlive: true, permission: ['devices'], hideInMenu: true }
              },
              {
                path: '/devices/device-list/add-device',
                name: 'AddDevice',
                component: () => import('@/views/devices/AddDevice.vue'),
                meta: { title: 'menu.devices.add-device', keepAlive: true, permission: ['devices'], hideInMenu: true }
              },
            ]
          },

          // {
          //   path: '/devices/device-list/device-detail/:id',
          //   name: 'DeviceDetail',
          //   component: () => import('@/views/devices/DeviceDetail.vue'),
          //   meta: { title: 'menu.devices.device-detail', keepAlive: true, permission: ['devices'], hideInMenu: true }
          // },
          {
            path: '/devices/car-type-list',
            name: 'CarTypeList',
            component: () => import('@/views/devices/CarTypeList.vue'),
            meta: { title: 'menu.devices.car-type-list', keepAlive: true, permission: ['devices'] }
          }
        ]
      },
      // charts
      {
        path: '/charts',
        name: 'charts',
        component: RouteViews,
        redirect: '/charts/device-chart-list',
        meta: { title: 'menu.charts', icon: 'BarChartOutlined', permission: ['charts'] },
        children: [
          {
            path: '/charts/device-chart-list',
            name: 'DeviceChartList',
            component: () => import('@/views/charts/DeviceChartList.vue'),
            meta: { title: 'menu.devices.device-list', keepAlive: true, permission: ['charts'] }
          },
        ]
      },
      // codeup
      {
        path: '/codeup',
        name: 'codeup',
        component: RouteViews,
        redirect: '/codeup/git-repository-list',
        meta: { title: 'menu.codeups', icon: 'BarChartOutlined', permission: ['codeup'] },
        children: [
          {
            path: '/codeup/git-repository-list',
            name: 'GitRepositoryList',
            component: () => import('@/views/codeup/GitRepositoryList.vue'),
            meta: { title: 'menu.codeups.codeup-list', keepAlive: true, permission: ['codeup'] }
          },
        ]
      },
      // flows
      {
        path: '/flows',
        name: 'flows',
        component: RouteViews,
        redirect: '/charts/flows-list',
        meta: { title: 'menu.flows', icon: 'BarChartOutlined', permission: ['flows'] },
        children: [
          {
            path: '/flows/flows-list',
            name: 'FlowsList',
            component: () => import('@/views/flows/FlowsList.vue'),
            meta: { title: 'menu.flows.flows-list', keepAlive: true, permission: ['flows'] }
          },
        ]
      },
      // applications
      {
        path: '/applications',
        name: 'applications',
        component: RouteViews,
        redirect: '/applications/app-list',
        meta: { title: 'menu.applications', icon: 'BarChartOutlined', permission: ['applications'] },
        children: [
          {
            path: '/applications/app-list',
            name: 'ApplicationList',
            component: () => import('@/views/application/ApplicationList.vue'),
            meta: { title: 'menu.applications.app-list', keepAlive: true, permission: ['applications'] }
          },
        ]
      },
      // packages
      {
        path: '/packages',
        name: 'packages',
        component: RouteViews,
        redirect: '/packages/package-list',
        meta: { title: 'menu.packages', icon: 'BarChartOutlined', permission: ['packages'] },
        children: [
          {
            path: '/packages/packages-list',
            name: 'PackageList',
            component: () => import('@/views/packages/PackageList.vue'),
            meta: { title: 'menu.packages.package-list', keepAlive: true, permission: ['packages'] }
          },
        ]
      },
      // system
      {
        path: '/system',
        name: 'system',
        component: RouteViews,
        redirect: '/system/user-list',
        meta: { title: 'menu.systems', icon: 'SettingOutlined', permission: ['systems'] },
        children: [
          {
            path: '/system/user-list',
            name: 'UserList',
            component: () => import('@/views/user/UsersList.vue'),
            meta: {
              title: 'menu.system.users-list',
              keepAlive: true,
              permission: ['users']
            }
          },
          {
            path: '/system/roles-list',
            name: 'RolesList',
            component: () => import('@/views/user/RolesList.vue'),
            meta: {
              title: 'menu.system.roles-list',
              keepAlive: true,
              permission: ['roles']
            }
          },
          {
            path: '/system/permission-list',
            name: 'PermissionList',
            component: () => import('@/views/user/PermissionList.vue'),
            meta: {
              title: 'menu.system.permission-list',
              keepAlive: true,
              permission: ['permission']
            }
          },
        ]
      },
    ]
  }
]


export default dynamicRoutes
